﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="tab_modifyshare.aspx.cs"
   Inherits="tab_modifyshare" EnableViewState="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
   <title>Modify My Shares</title>
      <style>
      .header_share
      {
         background-color: #abcdef;
         border: solid 1px black;
         padding: 3px;
      }
      .inputs_share
      {
         border: solid 1px black;
         padding: 3px;
      }
   </style>
   <script language="javascript">
      function body_onload()
      {
         top.resizeTo(900,400);
         top.moveTo(screen.width/2-450,screen.height/2-200)
      }
   </script>
</head>
<body onload="body_onload()">
   <form id="frm" runat="server">
   <asp:ScriptManager ID="ScriptManager" runat="server" />
   <table border="0">
      <tr valign="top">
         <td class="header_share">
            <b>I'm sharing </b>
            <asp:Literal ID="lbl_Tab" runat="server" />
            Tab with..
         </td>
      </tr>
      <tr valign="top">
         <td>
         <asp:Panel ID="Panel_SetRights" runat="server">
   <asp:GridView ID="GV_AccessRights" runat="server" AutoGenerateColumns="False" DataKeyNames="Source,UserID" EmptyDataText="Nobody!">
      <Columns>
         <asp:TemplateField HeaderText="Remove User">
            <ItemTemplate>
               <asp:CheckBox ID="cb_DeleteUser" runat="server" Checked='<%# Bind("User_Delete") %>' />
            </ItemTemplate>
            <ItemStyle VerticalAlign="Middle" />
         </asp:TemplateField>
         <asp:BoundField DataField="DisplayName" HeaderText="User" HtmlEncode="false" />
         <asp:TemplateField HeaderText="Permission">
            <ItemTemplate>
               <asp:DropDownList ID="ddl" runat="server" onchange="DDLChange(this)">
                  <asp:ListItem Value="X">-Quick Set-</asp:ListItem>
                  <asp:ListItem Value="3">None</asp:ListItem>
                  <asp:ListItem Value="0">Read</asp:ListItem>
                  <asp:ListItem Value="1">Read/Write</asp:ListItem>
                  <asp:ListItem Value="2">All Rights</asp:ListItem>
               </asp:DropDownList>
            </ItemTemplate>
            <ItemStyle VerticalAlign="Middle" />
         </asp:TemplateField>
         <asp:TemplateField HeaderText="Read">
            <ItemTemplate>
               <asp:CheckBox ID="cb_Read" runat="server" Checked='<%# Bind("Tab_Read") %>' />
            </ItemTemplate>
            <ItemStyle VerticalAlign="Middle" />
         </asp:TemplateField>
         <asp:TemplateField HeaderText="Edit Name">
            <ItemTemplate>
               <asp:CheckBox ID="cb_Tab_EditName" runat="server" Checked='<%# Bind("Tab_EditName") %>' />
            </ItemTemplate>
            <ItemStyle VerticalAlign="Middle" />
         </asp:TemplateField>
         <asp:TemplateField HeaderText="Share">
            <ItemTemplate>
               <asp:CheckBox ID="cb_Tab_Share" runat="server" Checked='<%# Bind("Tab_Share") %>' />
            </ItemTemplate>
            <ItemStyle VerticalAlign="Middle" />
         </asp:TemplateField>
         <asp:TemplateField HeaderText="Delete">
            <ItemTemplate>
               <asp:CheckBox ID="cb_Tab_Delete" runat="server" Checked='<%# Bind("Tab_Delete") %>' />
            </ItemTemplate>
            <ItemStyle VerticalAlign="Middle" />
         </asp:TemplateField>
         <asp:TemplateField HeaderText="Add Widget">
            <ItemTemplate>
               <asp:CheckBox ID="cb_Tab_AddWidgets" runat="server" Checked='<%# Bind("Tab_AddWidgets") %>' />
            </ItemTemplate>
            <ItemStyle VerticalAlign="Middle" />
         </asp:TemplateField>
         <asp:TemplateField HeaderText="Change Layout">
            <ItemTemplate>
               <asp:CheckBox ID="cb_Tab_ChangeLayout" runat="server" Checked='<%# Bind("Tab_ChangeLayout") %>' />
            </ItemTemplate>
            <ItemStyle VerticalAlign="Middle" />
         </asp:TemplateField>
         <asp:TemplateField HeaderText="Change Theme">
            <ItemTemplate>
               <asp:CheckBox ID="cb_Tab_ChangeTheme" runat="server" Checked='<%# Bind("Tab_ChangeTheme") %>' />
            </ItemTemplate>
            <ItemStyle VerticalAlign="Middle" />
         </asp:TemplateField>
         <asp:TemplateField HeaderText="Edit Widget Properties">
            <ItemTemplate>
               <asp:CheckBox ID="cb_Widget_Edit" runat="server" Checked='<%# Bind("Widget_Edit") %>' />
            </ItemTemplate>
            <ItemStyle VerticalAlign="Middle" />
         </asp:TemplateField>
         <asp:TemplateField HeaderText="Reorder Widget">
            <ItemTemplate>
               <asp:CheckBox ID="cb_Widget_Reorder" runat="server" Checked='<%# Bind("Widget_Reorder") %>' />
            </ItemTemplate>
            <ItemStyle VerticalAlign="Middle" />
         </asp:TemplateField>
         <asp:TemplateField HeaderText="Delete Widget">
            <ItemTemplate>
               <asp:CheckBox ID="cb_Widget_Delete" runat="server" Checked='<%# Bind("Widget_Delete") %>' />
            </ItemTemplate>
            <ItemStyle VerticalAlign="Middle" />
         </asp:TemplateField>
         <asp:TemplateField HeaderText="Edit Widget Title">
            <ItemTemplate>
               <asp:CheckBox ID="cb_Widget_EditTitle" runat="server" Checked='<%# Bind("Widget_EditTitle") %>' />
            </ItemTemplate>
            <ItemStyle VerticalAlign="Middle" />
         </asp:TemplateField>
      </Columns>
   </asp:GridView>
   <input type="button" id="btn_Add" value="Share to more Users" onclick="location.href='tab_share.aspx?id=<%= TabID %>';" />
   <asp:Button ID="btn_Confirm" runat="server" Text="Save new Permissions" 
      OnClick="btn_Confirm_Click" />
      </asp:Panel>
      </td></tr></table>

   <script language="javascript">
      function DDLChange(ddl)
      {
      //0 - read, 1-readwrite, 2-full
         var id = ddl.id.replace("ddl", "");
         $get(id + "cb_Read").checked = ddl.value == "0" || ddl.value == "1" || ddl.value == "2";
         $get(id + "cb_Tab_EditName").checked = ddl.value == "1" || ddl.value == "2";
         $get(id + "cb_Tab_Share").checked = ddl.value == "2";
         $get(id + "cb_Tab_Delete").checked = ddl.value == "2";
         $get(id + "cb_Tab_AddWidgets").checked = ddl.value == "1" || ddl.value == "2";
         $get(id + "cb_Tab_ChangeLayout").checked = ddl.value == "1" || ddl.value == "2";
         $get(id + "cb_Tab_ChangeTheme").checked = ddl.value == "1" || ddl.value == "2";
         $get(id + "cb_Widget_Edit").checked = ddl.value == "1" || ddl.value == "2";
         $get(id + "cb_Widget_Reorder").checked = ddl.value == "1" || ddl.value == "2";
         $get(id + "cb_Widget_Delete").checked = ddl.value == "1" || ddl.value == "2";
         $get(id + "cb_Widget_EditTitle").checked = ddl.value == "1" || ddl.value == "2";
      }                          
   </script>

   </form>
</body>
</html>
